<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .bw{
            width: 420px;
            height: 300px;
            margin: 100px auto;
        }

        li{
            list-style: none;  /* 取消list的小黑点 */
        }

        .bw li img{
            width: 100px;
            height: 80px;
            float: left;
            margin-top: 128px;
            cursor: pointer;
        }
        body{
            background: url(images/1.png) no-repeat center top
        }
    </style>
</head>
<body>
    <ul class="bw">
        <li><img src="images/1.png" alt=""></li>
        <li><img src="images/2.png" alt=""></li>
        <li><img src="images/3.png" alt=""></li>
        <li><img src="images/4.png" alt=""></li>
    </ul>

    <script>
        const imgObj = document.querySelectorAll("img")
        for(const imgs of imgObj){
            imgs.onclick = function(){
                document.body.style.backgroundImage = 'url('+this.src+')'
            }
        }
    </script>
</body>
</html>